//
//  DJRegistController.m
//  掌中会议通
//
//  Created by wanghy on 15/12/13.
//  Copyright © 2015年 wanghy. All rights reserved.
//

#import "DJRegistController.h"
#import "UIView+Frame.h"
#import "DJregistVIew.h"
#import "Masonry.h"
#import "MBProgressHUD.h"



@interface DJRegistController ()
@property(nonatomic,strong) UINavigationBar * bar;

@end

@implementation DJRegistController




- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:222 green:222 blue:222 alpha:1];
//    self.view.alpha = 1;


//    1.设置一个bar
    [self setNavagationBar];
//    2.搭建注册界面
    
    [self setUpRegist];
    

}

//设置bar
-(void)setNavagationBar{
    UINavigationBar * bar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
    
    
    UIButton * backButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 30, 40, 20)];
    [backButton setTitle:@"返回" forState:UIControlStateNormal];
    [backButton.titleLabel setFont:[UIFont systemFontOfSize:13]];
    [backButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(cancelRegist) forControlEvents:UIControlEventTouchUpInside];
    UILabel * registLabel =   [[UILabel alloc]init];
    registLabel.text = @"注册";
    registLabel.textAlignment = NSTextAlignmentCenter;
    //    label.backgroundColor = [UIColor grayColor];
    registLabel.font = [UIFont systemFontOfSize:13];
    registLabel.w = 50;
    registLabel.h = 20;
    registLabel.x = self.view.w/2 - (registLabel.w/2);
    registLabel.y = 30;
    [bar addSubview:registLabel];
    [bar addSubview:backButton];
    
    [self.view addSubview:bar];
    
    self.bar = bar;
    
}

-(void)setUpRegist{
    
   

    DJregistVIew * registView = [[[NSBundle mainBundle]loadNibNamed:@"regist" owner:self options:nil]firstObject];
    [self.view addSubview:registView];


    registView.x = 0;
    registView.y = 64;
    registView.w  = self.view.w;
    registView.dismissBlock = ^{
    
        [self cancelRegist];
    };

}

#pragma mark - 点击返回按钮触发的时间

- (void)cancelRegist {
    
        [self dismissViewControllerAnimated:YES completion:nil];

    
   
}



@end
